<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>店铺中心</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
    <style>
        html,
        body {
            width: 100%;
            min-height: 100%;
            background: #F3EFEE;
            line-height: 1;
        }

        ul {
            padding: 0.75rem 0 0 0;
        }

        ul li {
            position: relative;
            padding: 0.95rem;
            background-color: #fff;
            font-size: 0.7rem;
            font-weight: 600;
            color: #333;
            display: flex;
        }

        ul li::after {
            content: "";
            height: 1px;
            width: 100vw;
            position: absolute;
            bottom: 0;
            background: #e6e6e6;
            left: 0;
        }

        ul li:last-child::after {
            content: "";
            height: 0px;
            width: 100vw;
            position: absolute;
            bottom: 0;
            background: #e6e6e6;
            left: 0;
        }

        ul li .right_check {
            color: #666666;
        }

        ul li .right_check span {
            color: #666666;
        }

        ul .one_type {
            justify-content: center;
            align-items: center;
        }

        .one_type .input_box {
            flex: 1
        }

        .one_type .input_box .shop_name {
            height: 0.8rem;
            line-height: 0.8rem;
            padding-left: 1.25rem;
        }

        .two_type {
            justify-content: space-between;
            align-items: center;
        }

        .thr_type {
            align-items: center;
            justify-content: space-between;
        }

        .thr_type .input_box {
            flex: 1;
        }

        .thr_type .shop_weight,
        .thr_type .shop_price,
        .thr_type .shop_integral,
        .thr_type .shop_exchange_num,
        .thr_type .shop_have_num {
            height: 0.7rem;
            line-height: 0.7rem;
            padding: 0 1.25rem;
        }

        .other_box {
            padding: 0.75rem 0 0 0;
        }

        .other_box .title {
            padding: 0.95rem;
            background-color: #fff;
            font-size: 0.7rem;
            font-weight: 600;
            color: #333;
            position: relative;
        }

        .other_box .title::after {
            content: "";
            height: 1px;
            width: calc(100vw - 0.95rem);
            position: absolute;
            bottom: 0;
            right: 0;
            background: #e6e6e6;
        }

        .other_box .txt_box {
            background-color: #fff;
            padding: 0.95rem;
        }

        .other_box .txt_box textarea {
            font-size: 0.7rem;
            min-height: 6rem;
        }

        .other_box .title_box {
            padding: 0.95rem;
            background-color: #fff;
            font-size: 0.7rem;
            font-weight: 600;
            color: #333;
            position: relative;
            display: flex;
            justify-content: space-between;
            ;
            align-items: center;
        }

        .other_box .title_box::after {
            content: "";
            height: 1px;
            width: calc(100vw - 0.95rem);
            position: absolute;
            bottom: 0;
            right: 0;
            background: #e6e6e6;
        }
        /*图片列表*/

        .imgs_box {
            background-image: none!important;
            padding-top: 0.95rem;
            position: relative;
        }

        .imgs_box .delete_img {
            position: absolute;
            right: 0.2rem;
            top: 0.2rem;
            background: red;
            width: 0.7rem;
            height: 0.7rem;
            line-height: 0.7rem;
            text-align: center;
            border-radius: 50%;
            color: #fff;
        }

        .img_list_box {
            position: relative;
            background-image: none!important;
        }

        .img_list_box:after {
            content: "";
            height: 1px;
            width: calc(100% - 0.75rem);
            position: absolute;
            bottom: 0;
            background-color: #e6e6e6;
            right: 0;
        }

        .img_box img {
            border-radius: 0.2rem;
        }

        .aui-media-list .aui-list-item-inner {
            padding-top: 0!important;
            padding-bottom: 0.95rem!important;
        }
        /*多选框*/

        label {
            /*width: 100vw;*/
            display: flex;
            align-items: center;
        }

        .check_btn {
            margin-left: 0.75rem;
            margin-right: 0.5rem;
            width: 0.75rem;
            height: 0.75rem;
        }

        .check_btn:checked {
            background-color: #ff0036;
            border: 1px solid #ff0036;
        }

        .check_btn:checked::after,
        .check_btn:checked::before {
            width: 0.4rem;
            height: 0.2rem;
            margin-left: -0.25rem;
            margin-top: -0.2rem;
        }

        .agreement_box {
            padding: 1rem 0;
            font-size: 0.6rem;
            color: #666;
            display: flex;
            align-items: center;
        }

        .agreement_box .agreement {
            color: #f23030;
        }

        .submit_btn {
            font-size: 0.8rem;
            color: #fff;
            background-color: #f23030;
            padding: 1rem 0;
            margin: 0.375rem auto 1.25rem;
            width: 80%;
            text-align: center;
            border-radius: 2rem;
            font-weight: 600;
        }

        .not_show {
            display: none;
        }
    </style>
</head>

<body>
    <ul>
        <li class="one_type">
            <div class="title">商品名称</div>
            <div class="input_box">
                <input type="text" name="" value="" placeholder="商品名称不超过10个字" class="shop_name">
            </div>
        </li>
        <li class="two_type">
            <div class="title">商品类型</div>
            <div class="right_check" onclick="actionSheet_fn('商品类型')"><span class="shop_type">手机</span> <i class="aui-iconfont aui-icon-right"></i></div>
        </li>
        <li class="two_type">
            <div class="title">商品分类</div>
            <div class="right_check" onclick="actionSheet_fn('商品分类')"><span class="shop_classification">免费普通</span> <i class="aui-iconfont aui-icon-right"></i></div>
        </li>
        <div class="chose_dh_lx not_show">
            <li class="two_type">
                <div class="title">兑换产品类型</div>
                <div class="right_check" onclick="actionSheet_fn('兑换产品类型')"><span class="exchange_shop">普通兑换产品</span> <i class="aui-iconfont aui-icon-right"></i></div>
            </li>
        </div>
    </ul>
    <ul>
        <li class="two_type">
            <div class="title">运费类型</div>
            <div class="right_check" onclick="actionSheet_fn('运费类型')"><span class="freight_type">免邮</span> <i class="aui-iconfont aui-icon-right"></i></div>
        </li>

        <li class="thr_type">
            <div class="title">商品重量</div>
            <div class="input_box">
                <input type="number" name="" value="" placeholder="请输入商品重量" class="shop_weight">
            </div>
            <div class="right_check">KG</div>
        </li>

        <li class="thr_type">
            <div class="title">商品售价</div>
            <div class="input_box">
                <input type="number" name="" value="" placeholder="请输入商品售价" class="shop_price">
            </div>
            <div class="right_check">元</div>
        </li>

        <li class="thr_type not_show">
            <div class="title">所需积分</div>
            <div class="input_box">
                <input type="number" name="" value="" placeholder="请输入所需积分" class="shop_integral">
            </div>
            <div class="right_check">积分</div>
        </li>

        <li class="thr_type not_show">
            <div class="title">兑换币数</div>
            <div class="input_box">
                <input type="number" name="" value="" placeholder="请输入兑换币数" class="shop_exchange_num">
            </div>
            <div class="right_check">兑换币</div>
        </li>

        <li class="thr_type">
            <div class="title">商品库存</div>
            <div class="input_box">
                <input type="number" name="" value="" placeholder="请输入商品库存" class="shop_have_num">
            </div>
            <div class="right_check">件</div>
        </li>
    </ul>

    <div class="other_box">
        <div class="title">商品简介</div>
        <div class="txt_box">
            <textarea name="name" rows="8" cols="80" placeholder="请输入商品简介" class="shop_introduction"></textarea>
        </div>
    </div>

    <div class="other_box shop_cover_img">
        <div class="title">商品封面</div>
        <ul class="aui-list aui-media-list imgs_box">
            <li class="aui-list-item img_list_box">
                <div class="aui-list-item-inner">
                    <div class="aui-row aui-row-padded">
                        <div v-for="(src,index) in shop_cover_img_list" class="aui-col-xs-3 img_box">
                            <div class="img" :style="'background:url('+src+') center/cover no-repeat;'"></div>
                            <div class="delete_img" @click="remove_img(index)">×</div>
                        </div>
                        <div class="aui-col-xs-3" @click="add_imgs()" :class="{not_show:show}">
                            <div class="img" style="background:url(../../image/my/m34.png) center/cover no-repeat;"></div>
                        </div>
                    </div>
                </div>
            </li>
        </ul>
    </div>

    <div class="other_box shop_swiper_img">
        <div class="title_box">
            <div>商品轮播图</div>
            <div class="swiper_img">0/6</div>
        </div>
        <ul class="aui-list aui-media-list imgs_box">
            <li class="aui-list-item img_list_box">
                <div class="aui-list-item-inner">
                    <div class="aui-row aui-row-padded">
                        <div v-for="(src,index) in shop_swiper_img_list" class="aui-col-xs-3 img_box">
                            <div class="img" :style="'background:url('+src+') center/cover no-repeat;'"></div>
                            <div class="delete_img" @click="remove_img(index)">×</div>
                        </div>
                        <div class="aui-col-xs-3" @click="add_imgs()" :class="{not_show:show}">
                            <div class="img" style="background:url(../../image/my/m34.png) center/cover no-repeat;"></div>
                        </div>
                    </div>
                </div>
            </li>
        </ul>
    </div>

    <div class="other_box shop_detail_img">
        <div class="title_box">
            <div>商品详情图</div>
            <div class="detail_img">0/6</div>
        </div>
        <ul class="aui-list aui-media-list imgs_box">
            <li class="aui-list-item img_list_box">
                <div class="aui-list-item-inner">
                    <div class="aui-row aui-row-padded">
                        <div v-for="(src,index) in shop_detail_img_list" class="aui-col-xs-3 img_box">
                            <div class="img" :style="'background:url('+src+') center/cover no-repeat;'"></div>
                            <div class="delete_img" @click="remove_img(index)">×</div>
                        </div>
                        <div class="aui-col-xs-3" @click="add_imgs()" :class="{not_show:show}">
                            <div class="img" style="background:url(../../image/my/m34.png) center/cover no-repeat;"></div>
                        </div>
                    </div>
                </div>
            </li>
        </ul>
    </div>

    <div class="agreement_box">
        <label onclick="Laeawr(event)">
            <input class="aui-radio check_btn" type="checkbox" name="checkbox">我已认真阅读并同意
        </label>
        <span class="agreement" onclick="open_agreement()">《商品售卖协议》</span>

    </div>

    <div class="submit_btn">
        提交审核
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script type="text/javascript">
    // 商品类型按钮数组
    var shop_type_btns = [];
    var shop_type_btns_value = [];
    // 运费类型按钮数组
    var shop_freight_btns = [];
    var shop_freight_btns_value = [];

    // 定义上传商品所需的参数
    var shop_cate_id,shop_mode,shop_area_type,shop_freight_id;
    $('.shop_classification').attr('data-value', 1);
    $('.shop_classification').attr('data-value', 0);




    apiready = function() {
        // setRefresh()
        $('.img').height($('.img').width())

        get_shop_type();
        get_freight_type();
        // alert($('.shop_type').attr('data-value'))
    };

    var isLabel = false;

    function Laeawr(ev) {
        // ev.stopPropagation();
        if (ev.target.tagName == "LABEL") return;
        isLabel = !isLabel
        $('.submit_btn').unbind();
        if (isLabel) {
            $('.submit_btn').click(function() {
                // api.toast({
                //     msg: '提交成功',
                //     duration: 2000,
                //     location: 'bottom'
                // });
                upload_shop();
            })
        } else {
            $('.submit_btn').click(function() {
                api.toast({
                    msg: '您还未同意《商品售卖协议》',
                    duration: 2000,
                    location: 'bottom'
                });
            })
        }
    }
    $('.submit_btn').click(function() {
        api.toast({
            msg: '您还未同意《商品售卖协议》',
            duration: 2000,
            location: 'bottom'
        });
    })

    // 底部弹出框

    function actionSheet_fn(type) {
        if (type == '商品类型') {
            api.actionSheet({
                title: type,
                cancelTitle: '取消',
                buttons: shop_type_btns
            }, function(ret, err) {
                var index = ret.buttonIndex;
                if (index <= shop_type_btns.length) {
                    $('.shop_type').text(shop_type_btns[index - 1])
                    $('.shop_type').attr('data-value', shop_type_btns_value[index - 1]);
                }

            });

        } else if (type == "运费类型") {
            api.actionSheet({
                title: type,
                cancelTitle: '取消',
                buttons: shop_freight_btns
            }, function(ret, err) {
                var index = ret.buttonIndex;
                // alert(index)
                if (index <= shop_freight_btns.length) {
                    $('.freight_type').text(shop_freight_btns[index - 1])
                    $('.freight_type').attr('data-value', shop_freight_btns_value[index - 1]);
                }
            });
        } else if (type == "商品分类") {
            var classification_btns = ['免费普通', '积分', '兑换币'];
            var classification_btns_value = [1, 2, 3];
            api.actionSheet({
                title: type,
                cancelTitle: '取消',
                buttons: classification_btns
            }, function(ret, err) {
                var index = ret.buttonIndex;
                // alert(index)
                if (index <= 3) {
                    $('.shop_classification').text(classification_btns[index - 1])
                    $('.shop_classification').attr('data-value', classification_btns_value[index - 1]);
                }

                if (index == 3) {
                    $('.chose_dh_lx').show();
                } else {
                    $('.chose_dh_lx').hide();
                }
            });
        } else if (type == "兑换产品类型") {
            var exchange_shop_btns = ['普通兑换产品', '含赠品兑换产品'];
            var exchange_shop_btns_value = [0, 1];
            api.actionSheet({
                title: type,
                cancelTitle: '取消',
                buttons: exchange_shop_btns
            }, function(ret, err) {
                var index = ret.buttonIndex;
                // alert(index)
                if (index <= 2) {
                    $('.exchange_shop').text(exchange_shop_btns[index - 1]);
                    $('.exchange_shop').attr('data-value', exchange_shop_btns[index - 1]);
                }
            });
        }
    }


    // 请求商品类型接口
    function get_shop_type() {
        // 请求商品类型接口
        api.ajax({
            url: window.Url.Freestore_getGoodsCateList,
            method: 'post',
            data: {
                values: {
                    token: $api.getStorage('user_data').token
                }
            }
        }, function(ret, err) {
            if (ret) {
                for (var i in ret.data) {
                    if (ret.data[i].cate_two == '') {
                        shop_type_btns.push(ret.data[i].classname)
                        shop_type_btns_value.push(ret.data[i].cate_id)
                    } else {
                        shop_type_btns.push(ret.data[i].cate_two[0].classname)
                        shop_type_btns_value.push(ret.data[i].cate_two[0].cate_id)
                    }

                    if(i==0){
                      $('.shop_type').attr('data-value', shop_type_btns_value[i]);
                    }
                }
            } else {
                alert(JSON.stringify(err));
            }
        });
    }


    // 请求运费类型接口
    function get_freight_type() {
        api.ajax({
            url: window.Url.Freestore_getGoodsFreightList,
            method: 'post',
            data: {
                values: {
                    token: $api.getStorage('user_data').token
                }
            }
        }, function(ret, err) {
            if (ret) {
                if (ret.re == 1) {
                    for (var i in ret.data) {
                        shop_freight_btns.push(ret.data[i].classname)
                        shop_freight_btns_value.push(ret.data[i].freight_id)
                        if(i==0){
                          $('.freight_type').attr('data-value', shop_freight_btns_value[i]);
                        }
                    }
                }
            } else {
                alert(JSON.stringify(err));
            }
        });

    }


    // 所有需要的图片
    var all_img = {};
    // 实例化 vue 用作 商品封面上传图片
    // var shop_cover_pics = {};
    var shop_cover = new Vue({
        el: ".shop_cover_img",
        data: {
            shop_cover_img_list: [],
            show: false
        },
        methods: {

            // 添加图片
            add_imgs: function() {
                var $_this = this;
                var UIMediaScanner = api.require('UIMediaScanner');
                UIMediaScanner.open({
                    type: 'picture',
                    column: 3,
                    classify: false,
                    max: 1 - $_this.shop_cover_img_list.length,
                    sort: {
                        key: 'time',
                        order: 'desc'
                    },
                    texts: {
                        stateText: '已选择*',
                        cancelText: '取消',
                        finishText: '完成'
                    },
                    styles: {
                        bg: '#f7f7f7',
                        mark: {
                            icon: '',
                            position: 'top_right',
                            size: 20
                        },
                        nav: {
                            bg: '#f7f7f7',
                            stateColor: '#000',
                            stateSize: 18,
                            cancelBg: 'rgba(0,0,0,0)',
                            cancelColor: '#999',
                            cancelSize: 16,
                            finishBg: 'rgba(0,0,0,0)',
                            finishColor: '#ff0036',
                            finishSize: 16
                        }
                    },
                    exchange: true,
                    rotation: true
                }, function(ret) {
                    if (ret) {
                        if (ret.list) {
                            for (var i = 0; i < ret.list.length; i++) {
                                $_this.shop_cover_img_list.push(ret.list[i].path);
                                all_img['logo_pic'] = ret.list[i].path;
                            }
                            $_this.$nextTick(function() {
                                $('.img').height($('.img').width())
                                if ($_this.shop_cover_img_list.length >= 1) {
                                    $_this.show = true;
                                } else {
                                    $_this.show = false;
                                }
                            })
                        } else {
                            console.log('未选择图片');
                        }
                    }
                });
            },
            // 删除当前图片
            remove_img: function(index) {
                var $_this = this;
                $_this.shop_cover_img_list.splice(index, 1);
                if ($_this.shop_cover_img_list.length >= 1) {
                    $_this.show = true;
                } else {
                    $_this.show = false;
                }
            }
        }
    });


    // 实例化 vue 用作 商品轮播上传图片
    // var shop_swiper_pics = {};
    var shop_swiper = new Vue({
        el: ".shop_swiper_img",
        data: {
            shop_swiper_img_list: [],
            show: false
        },
        methods: {

            // 添加图片
            add_imgs: function() {
                var $_this = this;
                var UIMediaScanner = api.require('UIMediaScanner');
                UIMediaScanner.open({
                    type: 'picture',
                    column: 3,
                    classify: false,
                    max: 6 - $_this.shop_swiper_img_list.length,
                    sort: {
                        key: 'time',
                        order: 'desc'
                    },
                    texts: {
                        stateText: '已选择*',
                        cancelText: '取消',
                        finishText: '完成'
                    },
                    styles: {
                        bg: '#f7f7f7',
                        mark: {
                            icon: '',
                            position: 'top_right',
                            size: 20
                        },
                        nav: {
                            bg: '#f7f7f7',
                            stateColor: '#000',
                            stateSize: 18,
                            cancelBg: 'rgba(0,0,0,0)',
                            cancelColor: '#999',
                            cancelSize: 16,
                            finishBg: 'rgba(0,0,0,0)',
                            finishColor: '#ff0036',
                            finishSize: 16
                        }
                    },
                    exchange: true,
                    rotation: true
                }, function(ret) {
                    if (ret) {
                        if (ret.list) {
                            for (var i = 0; i < ret.list.length; i++) {
                                $_this.shop_swiper_img_list.push(ret.list[i].path);
                                if(i==0){
                                  all_img["pic"] = ret.list[i].path;
                                }else{
                                  all_img["pic" + i + ""] = ret.list[i].path;
                                }
                            }
                            $_this.$nextTick(function() {
                                $('.img').height($('.img').width())
                                $('.swiper_img').text($_this.shop_swiper_img_list.length + "/6")
                                if ($_this.shop_swiper_img_list.length >= 6) {
                                    $_this.show = true;
                                } else {
                                    $_this.show = false;
                                }
                            })
                        } else {
                            console.log('未选择图片');
                        }
                    }
                });
            },
            // 删除当前图片
            remove_img: function(index) {
                var $_this = this;
                $_this.shop_swiper_img_list.splice(index, 1);
                if(index==0){
                  delete(all_img['pic']);
                }else{
                  delete(all_img["pic"+index+""])
                }
                if ($_this.shop_swiper_img_list.length >= 6) {
                    $_this.show = true;
                } else {
                    $_this.show = false;
                }
            }
        }
    })


    // 实例化 vue 用作 商品详情上传图片
    // var shop_detail_pics = {};
    var shop_detail = new Vue({
        el: ".shop_detail_img",
        data: {
            shop_detail_img_list: [],
            show: false
        },
        methods: {

            // 添加图片
            add_imgs: function() {
                var $_this = this;
                var UIMediaScanner = api.require('UIMediaScanner');
                UIMediaScanner.open({
                    type: 'picture',
                    column: 3,
                    classify: false,
                    max: 6 - $_this.shop_detail_img_list.length,
                    sort: {
                        key: 'time',
                        order: 'desc'
                    },
                    texts: {
                        stateText: '已选择*',
                        cancelText: '取消',
                        finishText: '完成'
                    },
                    styles: {
                        bg: '#f7f7f7',
                        mark: {
                            icon: '',
                            position: 'top_right',
                            size: 20
                        },
                        nav: {
                            bg: '#f7f7f7',
                            stateColor: '#000',
                            stateSize: 18,
                            cancelBg: 'rgba(0,0,0,0)',
                            cancelColor: '#999',
                            cancelSize: 16,
                            finishBg: 'rgba(0,0,0,0)',
                            finishColor: '#ff0036',
                            finishSize: 16
                        }
                    },
                    exchange: true,
                    rotation: true
                }, function(ret) {
                    if (ret) {
                        if (ret.list) {
                            for (var i = 0; i < ret.list.length; i++) {
                                $_this.shop_detail_img_list.push(ret.list[i].path);

                                if(i==0){
                                  all_img["detail_pic"] = ret.list[i].path;
                                }else{
                                  all_img["detail_pic" + i + ""] = ret.list[i].path;
                                }
                            }
                            $_this.$nextTick(function() {
                                $('.img').height($('.img').width())
                                $('.detail_img').text($_this.shop_detail_img_list.length + "/6")
                                if ($_this.shop_detail_img_list.length >= 6) {
                                    $_this.show = true;
                                } else {
                                    $_this.show = false;
                                }
                            })
                        } else {
                            console.log('未选择图片');
                        }
                    }
                });
            },


            // 删除当前图片
            remove_img: function(index) {
                var $_this = this;
                $_this.shop_detail_img_list.splice(index, 1);
                if(index==0){
                  delete(all_img['detail_pic']);
                }else{
                  delete(all_img["detail_pic"+index+""])
                }
                $('.detail_img').text($_this.shop_detail_img_list.length + "/6")
                if ($_this.shop_detail_img_list.length >= 6) {
                    $_this.show = true;
                } else {
                    $_this.show = false;
                }
            }
        }
    })



    // 打开协议的方法
    function open_agreement() {
        api.ajax({
            url: window.Url.Freestore_getGoodsSellProtocol,
            method: 'post',
            data: {
                values: {
                    token: $api.getStorage('user_data').token
                }
            }
        }, function(ret, err) {
            if (ret) {
                if (ret.re == 1) {
                    var url = ret.data.url;
                    api.openWin({
                        name: 'agreement_win',
                        url: './headerone.html',
                        pageParam: {
                            msg: '《商品售卖协议》',
                            url: url
                        }
                    });
                }

            } else {
                alert(JSON.stringify(err));
            }
        });

    }



    // 商品上传接口
    function upload_shop() {

        if ($('.shop_name').val() == "" || $('.shop_weight').val() == "" || $('.shop_price').val() == "" || $('.shop_have_num').val() == ""||$('.shop_introduction').val()==""){
            api.toast({
                msg: '请完善相关信息',
                duration: 2000,
                location: 'bottom'
            });
        } else {
            if($('.exchange_shop').attr('data-value')==null){
              $('.exchange_shop').attr('data-value',"")
            }
            api.showProgress({
                style: 'default',
                animationType: 'fade',
                title: '努力加载中...',
                text: '先喝杯茶...',
                modal: false
            })

            api.ajax({
                url: window.Url.Freestore_setGoods,
                method: 'post',
                data: {
                    values: {
                        token: $api.getStorage('token'),
                        type: 1,
                        is_sale: 1,
                        is_new: 1,
                        is_agree: 1,
                        password: Base64.encode("UNO" + "135790" + "HACHA"),
                        goods_name: $('.shop_name').val(),
                        goods_title: $('.shop_introduction').val(),
                        cate_id: $('.shop_type').attr('data-value'),
                        weight: $('.shop_weight').val(),
                        mode: $('.shop_classification').attr('data-value'),
                        area_type:$('.exchange_shop').attr('data-value'),
                        freight_id: $('.freight_type').attr('data-value'),
                        price: $('.shop_price').val(),
                        oprice: $('.shop_price').val(),
                        store: $('.shop_have_num').val()
                    },
                    files: all_img
                }
            }, function(ret, err) {
                if (ret) {
                  api.hideProgress();
                  api.toast({
                      msg: ret.info,
                      duration: 1500,
                      location: 'bottom'
                  });
                  setTimeout(function(){
                      api.closeWin();
                  },1500)
                    console.log(JSON.stringify(ret));
                } else {
                  api.hideProgress();
                  console.log(JSON.stringify(ret));
                }
            });
        }
    }



    //刷新
    function setRefresh() {
        var pullRefresh = new auiPullToRefresh({
            container: document.querySelector('.aui-refresh-content'),
            triggerDistance: 100
        }, function(ret) {

            if (ret.status == "success") {
                setTimeout(function() {
                    pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
                }, 1500)
            }
        })
    }


    function uploadClose() {
        api.closeWin();

    }

    function goback() {
        api.closeWin();
    }
</script>

</html>
